<ui:composition template="/pages/workspace_page.xhtml"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:nxd="http://nuxeo.org/nxweb/document"
  xmlns:nxl="http://nuxeo.org/nxforms/layout"
  xmlns:nxw="http://nuxeo.org/nxforms/runtime/widget"
  xmlns:nxu="http://nuxeo.org/nxweb/util">

  <ui:define name="page title">
    <h:outputText value="#{nuxeoApplicationName} - #{messages['title.create.document']}" />
  </ui:define>

  <ui:define name="body">
    <div class="mainNoTabs">
    <h3>
      <h:outputText value="#{messages['title.create.document']} #{messages[typesTool.selectedType.label]}" />
    </h3>
    <ui:include src="/incl/message_banner.xhtml" />
    <h:form enctype="multipart/form-data" id="document_create">
      <h:outputScript target="#{pageJsTarget}">
        jQuery(document).ready(function() {
          jQuery('#document_create').focusFirst();
        });
      </h:outputScript>
      <nxl:documentLayout mode="create" value="#{changeableDocument}" />
      #{documentTemplatesActions.setTargetType(changeableDocument.type)}
      <f:subview rendered="#{! empty availableTemplates}">
        <h4>
          <h:outputText value="#{messages['label.templates.createFrom']}"/>
        </h4>
        <h:selectOneMenu id="selectTemplate"
          value="#{documentTemplatesActions.selectedTemplateId}">
          <f:selectItem itemValue="" itemLabel="#{messages['label.templates.none']}"/>
         <nxu:selectItems value="#{availableTemplates}" var="template"
                   itemValue="#{template.id}" itemLabel="#{template.dublincore.title}"/>
        </h:selectOneMenu>
      </f:subview>
      <div class="buttonsGadget">
        <input type="hidden" name="parentDocumentPath"
          value="#{currentDocument.pathAsString}" />
        <nxw:documentCreateButtons mode="view" value="#{changeableDocument}" />
      </div>
    </h:form>
    </div>
  </ui:define>

</ui:composition>